﻿Imports System.Net.Mail

Partial Class AboutUs
    Inherits System.Web.UI.Page

    Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
        
       
        Dim body As String = "From: " + txtName.Text + Environment.NewLine + "Email: " + txtEmail.Text + Environment.NewLine + "Subject : " + txtSubject.Text + Environment.NewLine + "Message: " + txtMessage.Text

        Dim mailMsg As New MailMessage
        mailMsg.From = New MailAddress("gotpink@joshrivera.com")
        mailMsg.To.Add(New MailAddress("gotpink@joshrivera.com"))
        mailMsg.Subject = "GotPink User - " + txtSubject.Text
        mailMsg.Body = body

        Dim smtp As New SmtpClient("smtp.1and1.com")
        smtp.EnableSsl = True
        smtp.Credentials = New System.Net.NetworkCredential("gotpink@joshrivera.com", "abcd1234")
        smtp.Port = 587
        smtp.Send(mailMsg)

        ClearAll()
        lblResult.Visible = True

        lblResult.Text = "Your message has been sent, thanks!"


    End Sub

    Protected Sub ClearAll()
        txtName.Text = ""
        txtEmail.Text = ""
        txtSubject.Text = ""
        txtMessage.Text = ""
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        lblResult.Visible = False
    End Sub
End Class
